import cv2

# dist = 20
# img = cv2.imread('beautify/before.jpg')
# img_new = cv2.bilateralFilter(img, dist, dist * 2, dist/2)
# cv2.imwrite('beautify/after.jpg', img_new)


img = cv2.imread('beautify/before.jpg')
grayImage = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)  #转换成灰度图片
  
(thresh, bwImg) = cv2.threshold(grayImage, 127, 255, cv2.THRESH_BINARY) #转换完全黑白
cv2.imwrite('beautify/gray.jpg', grayImage)
cv2.imwrite('beautify/backWhite.jpg', bwImg)
